package com.kjlink.demo.sofa.provider.impl;

import com.alipay.sofa.runtime.api.annotation.SofaService;
import com.alipay.sofa.runtime.api.annotation.SofaServiceBinding;
import com.kjlink.demo.sofa.common.model.FirstModel;
import com.kjlink.demo.sofa.common.service.FirstService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 描述:
 *
 * @author Vic.xu
 *
 * @since 2025-10-23 17:22
 */

@SofaService(bindings = @SofaServiceBinding(bindingType = "bolt"))
@Service
public class FirstServiceImpl implements FirstService {
    @Override
    public List<FirstModel> list() {
        List<FirstModel> list = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            list.add(new FirstModel(i, "name " + i * 10));
        }
        return list;
    }

    @Override
    public FirstModel get(Integer id) {
        return new FirstModel(id, "name " + id * 10);
    }

    @Override
    public Integer add(FirstModel firstModel) {
        return firstModel.getId() * 11;
    }
}
